

							<div class="layui-card homepage-bottom">
								<div class="layui-card-header">
									<h3 class="panel-title">
										<i class="layui-icon layui-icon-website"></i>
										在线升级
									</h3>
								</div>
								<div class="layui-card-body">
									<div class="panel-body layadmin-homepage-shadow">

										<div class="col-md-12">
											<div class="with-padding">
												<div class="alert alert-info">
													<p>
														当前 <span style="color: red">v{$Think.config.yicmf.version} </span>
														升级 <span style="color: red">v{$Think.session.nextVersion.version}</span>
													</p>
												</div>
												<p>
													<strong class="text-success">1.下载更新包</strong> <i class="fa fa-forward"></i>2.文件对比 <i class="fa fa-forward"></i> 3.代码升级 <i class="fa fa-forward"></i> 4.数据库升级 <i class="fa fa-forward"></i> 5.升级版本号
												</p>
												<div id="message" style="border: 1px solid #ccc; padding: 20px; height: 243px; overflow: auto">
													*初始化升级模式。<br />
												</div>
												<h4>本次更新涉及的本地文件</h4>
												<div id="file" style="border: 1px solid #ccc; padding: 20px; height: 250px; overflow: auto"></div>
												<h4>下载的文件存放位置</h4>
												<p>
													原版文件存放位置{:\\think\\facade\\Config::get('system_update_path')}{$Think.session.nextVersion.version}{$Think.DIRECTORY_SEPARATOR}original{$Think.DIRECTORY_SEPARATOR}
												</p>
												<p>
													更新文件存放位置{:\\think\\facade\\Config::get('system_update_path')}{$Think.session.nextVersion.version}{$Think.DIRECTORY_SEPARATOR}package{$Think.DIRECTORY_SEPARATOR}
												</p>
												<button  style="margin-top: 15px" id="compare_btn" disabled="disabled"  onclick="next('admin/Version/compare')" class="layui-btn layui-btn-fluid">升级文件包处理中</button>
												<div style="margin-top: 10px">
													<div class="progress progress-striped active hide"
														 style="border-radius: 3px">
														<div id="progress" class="progress-bar progress-bar-success"
															 role="progressbar" aria-valuenow="40" aria-valuemin="0"
															 aria-valuemax="100" style="width: 0"></div>
													</div>
												</div>
											</div>
										</div>
									</div>

								</div>
							</div>

<script>
	layui.use(['admin'], function () {
		var $ = layui.$
				, admin = layui.admin;

		function getFile(data){
			$.ajax( {
				type : "POST",
				url : "{:url()}",
				data:data,
				//返回数据的格式
				datatype: "json",
				success : function(result) {
					if( 'message' == result.type){
						$('#message').append(result.message);
					}
					if( 'file' == result.type){
						$('#file').append('<div><i class="icon-file"></i> '+result.file+'</div>');
					}
					if( 1 == result.is_end){
						$('#compare_btn').removeAttr('disabled','');
						$('#compare_btn').html(result.button);
					}
					if (0 == result.code) {
						getFile(result);
					}else{
						//提醒
					}
				},
				error : function(g) {
					//	$(this).alertmsg('error','结算请求异常，请稍后再试！');
					return;
				}
			});
		}
		var data='step=download&version={$Think.session.nextVersion.version}';
		getFile(data);

	});
</script>

